import axios from "/@/utils/http/axios";
import {MethodEnum} from "/@/utils/http/axios/enum/method-enum";
import {PageModel} from "/@/api/system/model/CommonModel";
import {FlowDesignDeployModel, FlowDesignModel, FlowDesignQueryModel} from "/@/api/flow/model/FlowDesignModel";

/**
 * 分页查询流程设计列表
 * @param isHint
 * @param callBack
 */
export function listFlowDesignPage(data: FlowDesignQueryModel,callBack?: Function):Promise<PageModel<FlowDesignModel[]>> {
    return axios.httpRequest("/flow/design/listFlowDesignPage", MethodEnum.GET, data, {callBack});
}


/**
 * 新增流程设计
 * @param callBack
 */
export function insertFlowDesign(data: FlowDesignModel,callBack?: Function):Promise<void> {
    return axios.httpRequest("/flow/design/insertFlowDesign", MethodEnum.POST, data, {callBack});
}

/**
 * 修改流程设计
 * @param callBack
 */
export function updateFlowDesign(data: FlowDesignModel,callBack?: Function):Promise<void> {
    return axios.httpRequest("/flow/design/updateFlowDesign", MethodEnum.POST, data, {callBack,isHint: false});
}

/**
 * 根据流程设计id删除流程设计
 * @param designId
 * @param callBack
 */
export function deleteFlowDesignByDesignId(designId: string,callBack?: Function):Promise<void> {
    return axios.httpRequest("/flow/design/deleteFlowDesignByDesignId", MethodEnum.GET, {designId}, {callBack});
}

/**
 * 根据流程设计id查询流程设计
 * @param designId
 * @param callBack
 */
export function selectFlowDesignByDesignId(designId: string,callBack?: Function):Promise<FlowDesignModel> {
    return axios.httpRequest("/flow/design/selectFlowDesignByDesignId", MethodEnum.GET, {designId}, {callBack});
}

/**
 * 部署流程设计
 * @param data
 * @param callBack
 */
export function deployFlowDesign(data: FlowDesignDeployModel,callBack?: Function):Promise<void> {
    return axios.httpRequest("/flow/design/deployFlowDesign", MethodEnum.POST, data, {callBack,isHint: false});
}